#bin/bash
choice1=1
choice2=2
echo "1.设置当前终端位gdb输出终端"
echo "2.恢复默认设置"
read choice
if test $[choice] -eq $[choice1]
then
    echo "开始设置gdbinti"
    tty_result=`tty`
    tty_number=${tty_result: -1}
    echo "source ~/pwndbg/gdbinit.py" > ~/.gdbinit
    echo "set disassembly-flavor intel" >> ~/.gdbinit
    tty_command="set context-output /dev/pts/$tty_number"
    echo $tty_command >> ~/.gdbinit
    echo "设置tty${tty_number}"
elif test $[choice] -eq $[choice2]
then
    echo "恢复初始设置"
    echo "source ~/pwndbg/gdbinit.py" > ~/.gdbinit
    echo "set disassembly-flavor intel" >> ~/.gdbinit
else 
    echo "您的输入有误！"
fi
